翻訳と辞書
Words near each other
・ Shuntarō
・ Shuntarō Itō
・ Shuntarō Tanikawa
・ ShuntCheck
・ Shunte District
・ Shunte Ki Chao?
・ Shunten
・ Shunter Coen
・ Shuntian
・ Shuntian Prefecture
・ Shunting
・ Shunting (disambiguation)
・ Shunting (rail)
・ Shunting inhibition
・ Shunting yard
Shunting-yard algorithm
・ Shuntokumichi Station
・ Shuntō
・ Shunya Itō
・ Shunya Shiraishi
・ Shunya Suganuma
・ Shunya Yoshimi
・ Shunyasampadane
・ Shunyi District
・ Shunyi Olympic Rowing-Canoeing Park
・ Shunyi Station
・ Shunyo
・ Shunyo Awnko
・ Shunyo E Buke
・ Shunyo Park


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Shunting-yard algorithm : ウィキペディア英語版
Shunting-yard algorithm

In computer science, the shunting-yard algorithm is a method for parsing mathematical expressions specified in infix notation. It can be used to produce output in Reverse Polish notation (RPN) or as an abstract syntax tree (AST). The algorithm was invented by Edsger Dijkstra and named the "shunting yard" algorithm because its operation resembles that of a railroad shunting yard. Dijkstra first described the Shunting Yard Algorithm in the Mathematisch Centrum report (MR 34/61 ).
Like the evaluation of RPN, the shunting yard algorithm is stack-based. Infix expressions are the form of mathematical notation most people are used to, for instance 3+4 or 3+4
*(2−1). For the conversion there are two text variables (strings), the input and the output. There is also a stack that holds operators not yet added to the output queue. To convert, the program reads each symbol in order and does something based on that symbol.
The shunting-yard algorithm has been later generalized into operator-precedence parsing.
==A simple conversion==

:Input: 3+4
#Add 3 to the output queue (whenever a number is read it is added to the output)
#Push + (or its ID) onto the operator stack
#Add 4 to the output queue
#After reading the expression, pop the operators off the stack and add them to the output.
# In this case there is only one, "+".
#Output 3 4 +
This already shows a couple of rules:
* All numbers are added to the output when they are read.
* At the end of reading the expression, pop all operators off the stack and onto the output.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Shunting-yard algorithm」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.